/****************************************************
 * Description: Entity for 菜单
 * Copyright:   Copyright (c) 2013
 * Company:     beiwaionline
 * @author      bfsu
 * @version     1.0
 * @see
	HISTORY
    *  2013-08-08 bfsu Create File
**************************************************/

package com.bfsuol.bfsuolframework.security.dao;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bfsuol.bfsuolframework.core.entity.Entity;
import com.bfsuol.bfsuolframework.core.entity.EntitySupport;
import lombok.Data;
import lombok.experimental.Accessors;
import org.codehaus.jackson.annotate.JsonIgnore;

import java.util.Collection;

@Data
@TableName("t_sec_menu")
@Accessors(chain = true)
public class Menu extends EntitySupport implements Entity {

    private static final long serialVersionUID = 1L;

    public Menu(){}
    public Menu(Long id){
        this.id = id;
    }

    @TableId( type = IdType.AUTO,value = "menu_id")
    private Long id;
    @TableField(value = "title")
    private String title;//名称
    @TableField(value = "description")
    private String description;//描述
    @TableField(value = "parent_id")
    private Long parentId;//父菜单
    @TableField(value = "privilege_code")
    private String privilegeCode;//对应权限
    @TableField(value = "url")
    private String url;//菜单地址
    @TableField(value = "is_sys")
    private Integer isSys;//是否系统菜单
    @TableField(value = "is_enabled")
    private Integer isEnabled;//是否可用
    @TableField(value = "order_sn")
    private Integer orderSn=(id==null?null:id.intValue());//菜单排序

    public boolean isNew() {
        return getId() == null || getId().longValue()<=0;
    }

}

